class RewardPenaltyTracker:
    """奖励惩罚跟踪器"""
    
    def __init__(self):
        self.total_batch_bonus = 0
        self.win_rate_bonus_history = []
        self.total_batch_penalties = 0
        self.batch_penalty_history = []
    
    def update_reward_penalty_stats(self, episode_win_rate_bonus: float = 0, 
                                  episode_batch_penalty: float = 0, episode: int = 0) -> None:
        """更新奖励惩罚统计"""
        self.total_batch_bonus += episode_win_rate_bonus
        self.win_rate_bonus_history.append((episode, episode_win_rate_bonus))
        
        self.total_batch_penalties += episode_batch_penalty
        self.batch_penalty_history.append((episode, episode_batch_penalty))
    
    def get_net_bonus(self) -> float:
        """获取净收益"""
        return self.total_batch_bonus - self.total_batch_penalties